<?php
/*
	should not be run except from cron
*/
include(APP_PATH . "3rdparty/lib_http/LIB_http.php");

class Batch_IndexController extends Veneer_Controller_Module
{
	function init()
	{
		parent::init();
		$this->_dbArray =array('Batch');
		$this->_moduleName = 'batch';
		$this->_primary_table ='batch';
		$this->_helper->LayoutManager->disableLayouts();
		$this->_helper->viewRenderer->setNoRender();
	}
    function indexAction()
    {
		$this->_veneer_log->info("Batch Start");

		for ( $counter = 1; $counter <= 10; $counter += 1) {

			$url = $this->_request->getBaseUrl();
			$target= "http://localhost" . $this->_request->getBaseUrl() . "/batch/test/" . $counter;
			$ref="http://localhost";

			$result = http_get($target,$ref);
			print $target . "*" .date('h:i:s')  ."<br/>";
			sleep(10);
			set_time_limit ( 60);
		}
    }
    function testAction()
    {
		$msg =  "*Executing job#" . $this->_veneer_parms['p1'] . " *" . time();
		$this->_veneer_log->info($msg);
		// listHelper
    }
}